 <template>
  <!-- 详细内容页面 -->
  <div id="container" v-loading="loading" v-show="!isEmpty">
    <!-- <el-collapse v-model="activeNames" v-loading="loading">
      <el-collapse-item title="基本信息" name="1"> -->
    <produce-order-detail
      ref="detail"
      :form="produceOrderData"
    ></produce-order-detail>
    <!-- </el-collapse-item> -->
    <!-- <el-collapse-item title="产品信息" name="2"> -->
    <produce-products-detail
      ref="productsDetail"
      :list="produceOrderData.produceProducts"
    ></produce-products-detail>
    <!-- </el-collapse-item>
    </el-collapse> -->
  </div>
  <el-empty
    description="暂无配送信息"
    v-show="isEmpty"
    style="height: 500px"
  ></el-empty>
</template>
<script>
import produceOrderDetail from './components/produceOrderDetail.vue'
import produceProductsDetail from './components/produceProductsDetail.vue'
import { queryTypeByDic } from '@/utils/getData'
export default {
  name: 'detail',
  data () {
    return {
      activeNames: ['1'],
      checkCofig: [],
      produceOrderData: {},
      loading: false,
      isEmpty: false
    }
  },
  components: {
    produceOrderDetail,
    produceProductsDetail,
  },
  beforeMount () {
    this.getType()
  },
  mounted () {

  },
  methods: {
    // 获取类型
    async getType () {
      this.produceStatus = await queryTypeByDic('produceStatus')
      this.getDetail()

    },
    async getDetail () {
      this.loading = true
      let { data } = await this.$API.contract.detailList.getProduceOrder.get({ contractId: this.$route.query.id })
      console.log(data)
      this.produceOrderData = data
      let arr = Object.keys(this.produceOrderData)
      if (arr.length == 0) {
        this.isEmpty = true
      } else {
        this.isEmpty = false
        this.produceStatus.forEach(item => {
          if (item.value == this.produceOrderData.type) {
            this.produceOrderData.typeName = item.name
          }
        })
      }

      this.loading = false
    },

  }
}
</script>
<style lang='scss' scoped>
#container {
  margin: 10px;
  :deep(.el-collapse-item__header) {
    padding-left: 20px;
    font-size: 16px;
  }
  :deep(.el-collapse-item__content) {
    padding: 0 20px 20px 20px;
  }
  :deep(.el-form-item) {
    margin-bottom: 5px;
  }
  :deep(.el-form-item__label) {
    color: #999;
  }
}
</style>